package com.extension.company.view.adapter;

import android.content.Context;
import android.media.Image;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.extension.company.admin.R;
import com.extension.company.common.utils.DisplayUtils;

import java.util.List;

public class SellerPageAdapter extends BaseRecyclerAdapter<String, SellerPageAdapter.Holder> {

    private LinearLayout.LayoutParams params;

    public SellerPageAdapter(Context context, List<String> list) {
        super(context, list);
        int screenWidth = DisplayUtils.getScreenWidth(context);
        int dp_12 = DisplayUtils.convertDip2Px(context, 12);
        params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, (screenWidth-dp_12*3)/2);
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
        super.onBindViewHolder(viewHolder, position);
    }

    @Override
    public SellerPageAdapter.Holder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = mInflater.inflate(R.layout.sellerpage_item, parent, false);
        Holder holder = new Holder(view);
        return holder;
    }

    class Holder extends RecyclerView.ViewHolder {

        private ImageView iv_photo;

        public Holder(@NonNull View itemView) {
            super(itemView);
            iv_photo = itemView.findViewById(R.id.iv_photo);
            iv_photo.setLayoutParams(params);
        }
    }
}
